package fr.vincent7894.feedroid.utils;

/**
 * Wrap simple object
 * 
 * @author vincent
 *
 * @param <T>
 */
public interface Wrapper<T> {
	
	interface Listener<T> {
		
		boolean onSet(T oldObj, T newObj);
	}
	
	void enList(Wrapper.Listener<T> listener);
	
	void deList(Wrapper.Listener<T> listener);
	
	/**
	 * Retrieve object
	 * 
	 * @return
	 */
	T get();
	
	/**
	 * Set object
	 * 
	 * Trigger listeners
	 * 
	 * return false if one listener return false
	 * 
	 * @param object
	 * @return
	 */
	boolean set(T object);
}
